<template>
  <div class="step-box" >
    <div class="step-item">
      <div :class="step >= 1 ? 'step-num active' : 'step-num'" >1</div>
      <div class="step-name">填写保单信息</div>
    </div>
    <div class="step-pro-1"></div>
    <div class="step-item">
      <div :class="step >= 2 ? 'step-num active' : 'step-num'" >2</div>
      <div class="step-name">确认投保信息</div>
    </div>
    <div class="step-pro-1"></div>
    <div class="step-item">
      <div :class="step >= 3 ? 'step-num active' : 'step-num'" >3</div>
      <div class="step-name">支付保费</div>
    </div>
    <div class="step-pro-1"></div>
    <div class="step-item">
      <div :class="step >= 4 ? 'step-num active' : 'step-num'" >
        <img src="@/assets/img/dui.png" class="step-icon">
      </div>
      <div class="step-name">完成</div>
    </div>

    <div class="step-progress" >
      <div class="step-progress-active" :style="{
        width : proWidth
      }"></div>
    </div>
  </div>
</template>

<script>
export default {
  props:{ step:{} },
  computed:{
    proWidth(){
      return (((this.step - 1) / 3) * 100)+'%';
    }
  }
}
</script>

<style scoped>
.step-box{
  display: flex;
  align-items: center;
  position: relative;
}

.step-item{
  display: flex;
  flex-flow: column;
  align-items: center;
  justify-content: center;
  width: 100px;
}

.step-num{
  width: 30px;
  height: 30px;
  border-radius: 15px;
  background: #D2D5DB;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
}

.step-item .active{
  background-color: #5180F9;
  color: #FFFFFF;
}

.step-icon{
  display: block;
  width: 15px;
  height: 15px;
}

.step-progress{
  background: #D2D5DB;
  height: 10px;
  position: absolute;
  width: calc(100% - 100px);
  left: 50px;
  top:10px;
  z-index: 1;
}
.step-pro-1{
  flex: 1;
}
.step-name{
  font-size: 16px;
  margin-top: 5px;
}

.step-progress-active{
  position: absolute;
  top:0;
  left: 0;
  width: 20%;
  height: 10px;
  background-color:#5180F9 ;
}

</style>